import java.util.Scanner;

public class main2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next().toString();
        String[] arr = str.split(",");
        int[] b = new int[arr.length];
        for (int j = 0; j < b.length; j++) {
            b[j] = Integer.parseInt(arr[j]);
        }
        int result = -2147483648;
        int temp = 0;
        for (int i = 0; i < b.length; i++) {
            temp += b[i];
            if (temp > result)
                result = temp;
            if (temp < 0)
                temp = 0;
        }
        System.out.println(result);
    }
}
